#include<iostream>
using namespace std;

int main()         //奖牌求和
{
    int n;
    cin >> n;
    int g,s,b;
    int sum_g=0,sum_s=0,sum_b=0;
    for(int i = 0;i<n;i++)
    {
        cin >> g >> s >> b;
        sum_g = sum_g + g;
        sum_s = sum_s + s;
        sum_b = sum_b + b;
    }
    int sum = sum_g + sum_s + sum_b;
    cout << sum_g << " " << sum_s << " " << sum_b << " " << sum << endl;
    return 0;
}